package com.skyline.jfs.base.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.DigestUtils;

import com.skyline.jfs.base.dao.AdminBasicDao;
import com.skyline.jfs.base.model.Administrator;
import com.skyline.jfs.base.service.AdminBasicService;

@Service("adminBasicService")
public class AdminBasicServiceImpl implements AdminBasicService {

	@Autowired
	private AdminBasicDao adminBasicDao;
	//private
	
	public Administrator login(Long jobNum, String password){
		password = String.valueOf(DigestUtils.md5DigestAsHex(password
				.getBytes()));
		System.out.println(password);
		return adminBasicDao.find(jobNum, password);
	}

	public List<Administrator> getAll(){
		return adminBasicDao.findAll();
	}

	public Administrator getById(Integer id){
		return adminBasicDao.findById(id);
	}
	
	public Administrator getByJobNum(Long jobNum){
		return adminBasicDao.findByJobNum(jobNum);
	}
}
